﻿//==============================================================================
// File: IActionService.cs
// Created: 2010-06-07
// Author: Piotr Włodek, Arkadiusz Świerczek
//==============================================================================
// This file is a part of MAMMOTH project.
// Copyright (C) 2010 AGH University of Science and Technology, Krakow.
// https://caribou.iisg.agh.edu.pl/trac/mammoth
//
// Mammoth is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// Mammoth is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with Mammoth. If not, see http://www.gnu.org/licenses/.
//==============================================================================

using System;
using System.Windows.Input;

namespace WpfRcp.Core.Services
{
    public interface IActionService
    {
        /// <summary>
        /// Executes an action identified by <paramref name="action"/> parameter.
        /// </summary>
        /// <param name="action">Action to be executed.</param>
        /// <param name="canExecuteParameter">Parameter for the CanExecute delegate.</param>
        /// <param name="alternativeActionParameter">Parameter for the AlternativeAction delegate.</param>
        /// <param name="args">An array of parameters for the Action delegate.</param>
        /// <returns>The return value is determined by the return value of the action itself.</returns>
        object InvokeAction(string action, object canExecuteParameter,
                            object alternativeActionParameter, params object[] args);

        void RegisterAction(string key, ICommand command);
        void RegisterAction(string key, ICommand command, Action<object> alternativeAction);
        void RegisterAction(string key, Delegate action);
        void RegisterAction(string key, Delegate action, Func<object, bool> canExecute);

        void RegisterAction(string key, Delegate action,
                            Func<object, bool> canExecute, Action<object> alternativeAction);

        /// <summary>
        /// Executes an action identified by <paramref name="action"/> parameter.
        /// </summary>
        /// <param name="action">Action to be executed.</param>
        /// <returns>The return value is determined by the return value of the action itself.</returns>
        object ExplicitInvokeAction(string action);

        /// <summary>
        /// Executes an action identified by <paramref name="action"/> parameter.
        /// </summary>
        /// <param name="action">Action to be executed.</param>
        /// <param name="arg1">First parameter for the Action delegate.</param>
        /// <returns>The return value is determined by the return value of the action itself.</returns>
        object ExplicitInvokeAction(string action, object arg1);

        /// <summary>
        /// Executes an action identified by <paramref name="action"/> parameter.
        /// </summary>
        /// <param name="action">Action to be executed.</param>
        /// <param name="arg1">First parameter for the Action delegate.</param>
        /// <param name="arg2">Second parameter for the Action delegate.</param>
        /// <returns>The return value is determined by the return value of the action itself.</returns>
        object ExplicitInvokeAction(string action, object arg1, object arg2);

        /// <summary>
        /// Executes an action identified by <paramref name="action"/> parameter.
        /// </summary>
        /// <param name="action">Action to be executed.</param>
        /// <param name="arg1">First parameter for the Action delegate.</param>
        /// <param name="arg2">Second parameter for the Action delegate.</param>
        /// <param name="arg3">Third parameter for the Action delegate.</param>
        /// <returns>The return value is determined by the return value of the action itself.</returns>
        object ExplicitInvokeAction(string action, object arg1, object arg2, object arg3);

        /// <summary>
        /// Executes an action identified by <paramref name="action"/> parameter.
        /// </summary>
        /// <param name="action">Action to be executed.</param>
        /// <param name="canExecuteParam">Parameter for the CanExecute delegate.</param>
        /// <param name="alternativeActionParam">Parameter for the AlternativeAction delegate.</param>
        /// <returns>The return value is determined by the return value of the action itself.</returns>
        object FullExplicitInvokeAction(string action, object canExecuteParam,
                                        object alternativeActionParam);

        /// <summary>
        /// Executes an action identified by <paramref name="action"/> parameter.
        /// </summary>
        /// <param name="action">Action to be executed.</param>
        /// <param name="canExecuteParam">Parameter for the CanExecute delegate.</param>
        /// <param name="alternativeActionParam">Parameter for the AlternativeAction delegate.</param>
        /// <param name="arg1">First parameter for the Action delegate.</param>
        /// <returns>The return value is determined by the return value of the action itself.</returns>
        object FullExplicitInvokeAction(string action, object canExecuteParam,
                                        object alternativeActionParam, object arg1);

        /// <summary>
        /// Executes an action identified by <paramref name="action"/> parameter.
        /// </summary>
        /// <param name="action">Action to be executed.</param>
        /// <param name="canExecuteParam">Parameter for the CanExecute delegate.</param>
        /// <param name="alternativeActionParam">Parameter for the AlternativeAction delegate.</param>
        /// <param name="arg1">First parameter for the Action delegate.</param>
        /// <param name="arg2">Second parameter for the Action delegate.</param>
        /// <returns>The return value is determined by the return value of the action itself.</returns>
        object FullExplicitInvokeAction(string action, object canExecuteParam,
                                        object alternativeActionParam, object arg1, object arg2);

        /// <summary>
        /// Executes an action identified by <paramref name="action"/> parameter.
        /// </summary>
        /// <param name="action">Action to be executed.</param>
        /// <param name="canExecuteParam">Parameter for the CanExecute delegate.</param>
        /// <param name="alternativeActionParam">Parameter for the AlternativeAction delegate.</param>
        /// <param name="arg1">First parameter for the Action delegate.</param>
        /// <param name="arg2">Second parameter for the Action delegate.</param>
        /// <param name="arg3">Third parameter for the Action delegate.</param>
        /// <returns>The return value is determined by the return value of the action itself.</returns>
        object FullExplicitInvokeAction(string action, object canExecuteParam,
                                        object alternativeActionParam, object arg1, object arg2, object arg3);
    }
}